var _util = require('../util/util.js');
var _header_service = {
    //获取商品一级分类
    getAllCategories: function (resolve, reject) {
        _util.request({
            url: _util.getServerURL('/catalog/categories'),
            method: 'GET',
            success: resolve,
            error: reject
        });
    },
    //模糊查询
    searchItems: function (pagesize, pageid, keyword, categoryid, sortby, resolve, reject) {
        let urlStr = '/catalog/items/query/pages/' + pagesize + '/' + pageid + '?keyword=' + keyword + '&categoryId=' + categoryid + '&sortby=' + sortby;
        _util.request({
            url: _util.getServerURL(urlStr),
            method: 'GET',
            success: resolve,
            error: reject
        })
    }
}

module.exports = _header_service;